package com.xingdata.jjxc.activity.fragment;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.xingdata.jjxc.R;
import com.xingdata.jjxc.R.id;
import com.xingdata.jjxc.R.layout;
import com.xingdata.jjxc.adapter.VoideAdp;
import com.xingdata.jjxc.enty.VoideEntity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

//精彩視頻
public class NetWorkVideoFragment extends Fragment {
	private GridView video_lv;
	private VoideEntity entity;
	private List<VoideEntity> entities = new ArrayList<VoideEntity>();
	private VoideAdp mAdp;
	private TextView textview;
	private View view;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		view = inflater.inflate(R.layout.splendidfragment, container, false);
		video_lv = (GridView) view.findViewById(R.id.video_lv);
		videoview();
		return view;
	}

	private void videoview() {
		
		if(entities.size()!=0){
			entities.clear();
		}
		entity = new VoideEntity();
		for (int i = 0; i < 10; i++) {
			entity.setfTime("15/11");
			entity.setfSize("12mb");
			entities.add(entity);
		}
		mAdp = new VoideAdp(this.getActivity(), entities);
		video_lv.setAdapter(mAdp);
		
		// List<Map<String, Object>> mlist = new ArrayList<Map<String,
		// Object>>();
		// Map<String, Object> list = new HashMap<String, Object>();
		// for (int i = 0; i < 100; i++) {
		// list.put("imageview", R.drawable.findphoto);
		// list.put("circulationdate", "15/10/12");
		// list.put("flow", "12mb");
		// mlist.add(list);
		// }
		// SimpleAdapter simpleAdapter = new SimpleAdapter(getActivity(), mlist,
		// R.layout.splendid, new String[] { "imageview",
		// "circulationdate", "flow" }, new int[] { R.id.textview,
		// R.id.circulationdate, R.id.flow });
		// video_lv.setAdapter(simpleAdapter);
		// textview = (TextView) getActivity().findViewById(R.id.textview);
		// textview.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View v) {
		// Intent intent = new Intent(getActivity(),
		// FindallPost_videoActivity.class);
		// getActivity().startActivity(intent);
		// }
		// });
	}
}
